package com.xinxuan.usercenter.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xinxuan.usercenter.domain.User;
import com.xinxuan.usercenter.dto.UserAddBonusDTO;
import com.xinxuan.usercenter.service.UserService;

/**
 * @author xinsl
 * @date 2022/1/11
 */
@RestController
@RequestMapping("/users")
public class BonseController {

    @Autowired
    private UserService userService;

    @PutMapping("/add-bonus")
    public User addBonus(@RequestBody UserAddBonusDTO userAddBonseDTO) {
        userService.addBonus(userAddBonseDTO);
        return userService.findById(userAddBonseDTO.getUserId());
    }
}
